package com.csun.cmny.provider.dao;

import com.csun.cmny.provider.model.domain.UacAction;
import com.csun.cmny.provider.model.domain.UacGroupRoleAction;
import com.csun.cmny.provider.model.domain.UacRoleAction;
import com.csun.cmny.provider.model.dto.group.GroupActionQueryDto;
import com.csun.cmny.provider.model.dto.group.GroupRoleDto;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Set;

public interface UacGroupRoleActionMapper extends Mapper<UacGroupRoleAction> {

    /**
     * 批量添加机构角色功能
     *
     * @param groupId           the group id
     * @param uacRoleActionList the uac role action list
     *
     * @return the int.
     */
    Integer batchSaveGroupRoleAction(@Param("groupId") Long groupId,
                                     @Param("uacRoleActionList") List<UacRoleAction> uacRoleActionList);

    /**
     * 批量移除机构角色功能
     *
     * @param groupId       the group id
     * @param roleId        the role id
     * @param actionIdList  the action id list
     *
     * @return  the int.
     */
    Integer batchDeleteRoleAction(@Param("groupId") Long groupId,
                                  @Param("roleId") Long roleId,
                                  @Param("actionIdList") List<Long> actionIdList);

    /**
     * 批量添加机构角色功能
     *
     * @param groupId       the group id
     * @param roleId        the role id
     * @param actionIdList  the action id list
     *
     * @return  the int.
     */
    Integer batchSaveRoleAction(@Param("groupId") Long groupId,
                                @Param("roleId") Long roleId,
                                @Param("actionIdList") List<Long> actionIdList);

    /**
     * 获取选中的功能列表
     *
     * @param groupRoleDto the group role dto
     *
     * @return the list
     */
    List<Long> getCheckedActionList(GroupRoleDto groupRoleDto);

    /**
     * 获取机构功能列表(所有)
     *
     * @param groupActionQueryDto   the group action query dto
     *
     * @return  the list.
     */
    List<UacAction> queryActionList(GroupActionQueryDto groupActionQueryDto);

    /**
     * 获取机构角色功能列表(选中)
     *
     * @param groupActionQueryDto   the grou action query dto
     *
     * @return  the list.
     */
    List<UacAction> queryRoleActionList(GroupActionQueryDto groupActionQueryDto);

    /**
     * select count by role id and action id list
     *
     * @param roleId       the role id
     * @param actionIdList the action id list
     *
     * @return the int
     */
    int selectCountRoleIdAndActionIdList(@Param("roleId") Long roleId,
                                         @Param("actionIdList") List<Long> actionIdList);

    /**
     * select count action id and role id list
     *
     * @param actionId      action id
     * @param roleIdList    role id list
     *
     * @return the int.
     */
    int selectCountActionIdAndRoleIdList(@Param("actionId") Long actionId,
                                         @Param("roleIdList") List<Long> roleIdList);
}